package com.ssm.controller;

import com.ssm.pojo.SysMenu;
import com.ssm.service.MenuService;
import com.ssm.util.ResultData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

import static com.ssm.shrio.ShiroUtils.getUserId;

/**
 * Created by 墨殇
 * 2017/12/26.
 * @author Administrator
 */
@Controller
@RequestMapping("/sys/menu")
public class MenuController {
@Autowired
private MenuService menuService;
    /**
     * 用户菜单列表
     */
    @ResponseBody
    @RequestMapping("/user")
    public ResultData user() {
        List<SysMenu> menuList = menuService.getUserMenuList(getUserId());

        return ResultData.ok().put("menuList", menuList);
    }
}
